package yang.itcode.controller;

import cn.hutool.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import yang.itcode.model.Result;
import yang.itcode.service.CostService;

@RestController
@RequestMapping("/api/cost")
public class CostController {

    @Autowired
    private CostService costService;

    @PostMapping("/change/list")
    public Result<JSONObject> getCostChangeList(@RequestBody JSONObject obj) {
        return Result.success(costService.getCostChangeList(obj));
    }

    @PostMapping("/adjust")
    public Result<Boolean> adjustCost(@RequestBody JSONObject obj) {
        costService.adjustCost(obj);
        return Result.success(true);
    }
}
